/*
 * Copyright (c) 2012 Skyon Technology Ltd.
 * All rights reserved.
 *
 * project: sagittarius
 * create: 2012-9-12 上午11:36:57
 * cvs: $Id: $
 */
package cn.batch.daemon.procWebservice.client;

import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;

import cn.batch.daemon.procWebservice.bean.HtmlParseListRequest;
import cn.batch.daemon.procWebservice.bean.HtmlParseResponse;
import cn.batch.daemon.util.WebServiceUrlConfig;

/**
 * 调用人行征信 webService接口类
 * 
 * @author xihn
 * @version $Revision:$
 */
public class ProcWebserviceClient {

	public static HtmlParseResponse getProcResult(HtmlParseListRequest re) throws Exception {
		JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
		org.apache.cxf.endpoint.Client client = dcf.createClient(WebServiceUrlConfig.PROC_WEBSERVICE_URL);
		HTTPConduit http = (HTTPConduit)client.getConduit();
		HTTPClientPolicy hp = new HTTPClientPolicy();
		hp.setConnectionTimeout(60000);
		hp.setAllowChunking(false);
		hp.setReceiveTimeout(180000);
		http.setClient(hp);
		Object[] objects;
		objects = client.invoke("returnHtmlParseBatchHandleResultCode", re);
		HtmlParseResponse rs = (HtmlParseResponse)objects[0];
		return rs;
	}
}
